export class BaseEntity {
  id?: string;
  version?: number;
  createBy?: string;
  updateBy?: string;
  createTime?: Date | null;
  updateTime?: Date | null;

  constructor(o?: any) {
    this.id = o && o.id !== null ? o.id : null;
    this.version = o && o.version !== null ? o.version : null;
    this.createBy = o && o.createBy !== null ? o.createBy : null;
    this.updateBy = o && o.updateBy !== null ? o.updateBy : null;
    this.createTime = o && o.createTime !== null ? new Date(o.createTime) : null;
    this.updateTime = o && o.updateTime !== null ? new Date(o.updateTime) : null;
  }

  isNew(): boolean {
    return this.id === null;
  }
}
